﻿@using ZBJF.Warranty.BLL
@using ZBJF.Warranty.Common.Enums.InsuranceProducts
@using ZBJF.Warranty.Model
@using EnumHelper = ZBJF.Warranty.Common.Common.EnumHelper
@model ZBJF.Warranty.Model.InsuranceProductOrder
@{
    var firstImage = ServiceFactory.SellerInsuranceProductImagesServiceInstance.GetFirstImageByProductId(Model.SellerInsuranceProductID);
    var tags = ServiceFactory.SellerInsuranceProductTagsServiceInstance.LoadBySellerInsuranceProductId(Model.SellerInsuranceProductID).ToList().Select(o => o.TagName).Aggregate(string.Empty, (c, d) => c + "," + d).Trim(',');
}
<div class="desc_forward_title" onclick="history.back(-1)">
    订单详情
</div>
<a href="javascript:void(0)" class="weui-media-box weui-media-box_appmsg">
    <div class="weui-media-box__hd">
        <img class="weui-media-box__thumb" src="@(firstImage != null ? firstImage.FilePath : "/images/share_img.jpg")">
    </div>
    <div class="weui-media-box__bd">
        <h4 class="weui-media-box__title">@Model.InsuranceProductName</h4>
        <p class="weui-media-box__desc">@(HttpUtility.HtmlDecode(tags))</p>
        <div class="margin-t-20">
            <p class="weui-media-box__desc price_desc  float-left" title="价格">@Model.SaleRetailPrice.ToString("c")</p>
        </div>
    </div>
</a>
<div class="bg-master padding-5" onclick="history.back(-1)">
    订单信息
</div>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">订单号</label></div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.OrderNo, new { @class = "weui-label" })
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">保险产品名称</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.InsuranceProductName, new { @class = "weui-label" })
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">订单状态</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @(ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceProductOrderStatus), Model.Status))
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">下单时间</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.CreateOrderTime, new { @class = "weui-label" })
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">购买数量</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.BuyCount, new { @class = "weui-label" })
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">总价</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.TotalPirce, new { @class = "weui-label" })
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">用户姓名</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.BuyUserName, new { @class = "weui-label" })
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">身份证号</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.BuyUserIDNo, new { @class = "weui-label" })
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">Email</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.BuyUserEmail, new { @class = "weui-label" })
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">手机</label>
        </div>
        <div class="weui-cell__bd weui-cell_primary">
            @Html.DisplayFor(o => o.BuyUserPhone, new { @class = "weui-label" })
        </div>
    </div>
    @if (Model.Status == (byte)InsuranceProductOrderStatus.Paid)
    {
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">支付时间</label></div>
            <div class="weui-cell__bd weui-cell_primary">
                @Html.DisplayFor(o => o.PayTime, new { @class = "weui-label" })
            </div>
        </div>
    }
    else if (Model.Status == (byte)InsuranceProductOrderStatus.PendingPayment)
    {
    }
    else
    {
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">取消时间</label></div>
            <div class="weui-cell__bd weui-cell_primary">
                @Html.DisplayFor(o => o.CancelTime, new { @class = "weui-label" })
            </div>
        </div>
    }
</div>
